package com.cet.designpatterns.responsibilitychain;

import java.math.BigDecimal;

/**
 * @program: algorithm
 * @description:
 * @author: 陈恩涛
 * @create: 2021-09-29 10:41
 **/
public class Client {
    public static void main(String[] args) {
        PurchaseRequest request = new PurchaseRequest(1, new BigDecimal("31000"), 1);

        Approver departmentApprover = new DepartmentApprover("张主任");
        Approver collegeApprover = new CollegeApprover("李院长");
        Approver vicePresidentApprover = new VicePresidentApprover("王副校长");
        Approver headmasterApprover = new HeadmasterApprover("佟校长");

        // 处理人构成环形，总有一个人处理，处理可以从任意一个人开始
        departmentApprover.setNext(collegeApprover);
        collegeApprover.setNext(vicePresidentApprover);
        vicePresidentApprover.setNext(headmasterApprover);
        headmasterApprover.setNext(departmentApprover);

        vicePresidentApprover.processRequest(request);
    }
}
